﻿using Oracle.ManagedDataAccess.Client;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;

namespace Waiyun.WebApi
{
    public class KongyunController : ApiController
    {
        public static string[] s_times1 = new string[] { "08:40:55", "08:44:00", "08:45:06", "08:49:21", "08:50:54", "08:52:13", "08:52:40", "08:53:35", "08:53:36", "08:53:38", "08:53:51", "08:56:54", "08:57:29", "08:59:53", "09:00:18", "09:04:34", "09:04:38", "09:09:23", "09:09:57", "09:10:44", "09:11:05", "09:12:07", "09:12:46", "09:12:53", "09:13:28", "09:14:07", "09:14:49", "09:15:02", "09:15:21", "09:15:55", "09:16:18", "09:16:25", "09:16:44", "09:17:21", "09:17:33", "09:17:35", "09:18:01", "09:20:11", "09:21:52", "09:23:41", "09:23:41", "09:23:47", "09:24:17", "09:24:34", "09:24:40", "09:24:54", "09:28:47", "09:29:00", "09:30:04", "09:31:13", "09:31:17", "09:31:25", "09:33:33", "09:33:34", "09:33:35", "09:34:55", "09:36:10", "09:37:02", "09:38:15", "09:39:24", "09:39:56", "09:43:03", "09:43:48", "09:43:54", "09:43:58", "09:43:59", "09:44:11", "09:45:16", "09:46:25", "09:47:04", "09:48:37", "09:50:23", "09:51:44", "09:54:08", "09:54:09", "09:54:09", "09:54:09", "09:54:09", "09:54:09", "09:54:10", "09:54:10", "09:54:10", "09:54:10", "09:54:10", "09:54:10", "09:54:11", "09:54:11", "09:54:11", "09:54:11", "09:54:11", "09:54:11", "09:54:12", "09:54:12", "09:54:12", "09:54:12", "09:54:12", "09:54:12", "09:54:12", "09:54:13", "09:54:13", "09:54:13", "09:54:13", "09:54:13", "09:54:13", "09:54:14", "09:54:14", "09:54:14", "09:54:14", "09:54:14", "09:54:14", "09:54:30", "09:54:44", "09:54:54", "09:55:34", "09:56:49", "09:57:43", "09:59:24", "10:04:01", "10:04:10", "10:04:47", "10:05:45", "10:07:18", "10:07:19", "10:09:43", "10:10:03", "10:10:08", "10:11:19", "10:13:34", "10:13:46", "10:13:55", "10:14:33", "10:17:52", "10:21:30", "10:21:31", "10:21:32", "10:21:32", "10:21:48", "10:23:46", "10:26:27", "10:26:37", "10:27:04", "10:27:52", "10:29:19", "10:30:53", "10:32:40", "10:32:52", "10:34:24", "10:34:49", "10:36:59", "10:38:11", "10:38:12", "10:39:50", "10:40:35", "10:40:39", "10:41:28", "10:41:45", "10:42:42", "10:43:26", "10:43:40", "10:43:43", "10:43:44", "10:45:24", "10:45:35", "10:45:42", "10:46:22", "10:46:34", "10:46:41", "10:47:20", "10:47:24", "10:47:52", "10:48:24", "10:50:26", "10:50:56", "10:54:08", "10:54:16", "10:55:55", "10:56:22", "10:57:32", "10:58:17", "10:58:18", "10:58:26", "11:01:56", "11:01:57", "11:03:28", "11:03:50", "11:04:02", "11:04:56", "11:05:28", "11:07:43", "11:07:44", "11:08:05", "11:09:03", "11:10:41", "11:10:56", "11:11:19", "11:12:17", "11:14:11", "11:15:06", "11:15:25", "11:16:38", "11:16:55", "11:17:30", "11:18:03", "11:18:08", "11:18:54", "11:23:03", "11:23:59", "11:24:25", "11:24:35", "11:24:38", "11:24:40", "11:25:11", "11:25:24", "11:26:50", "11:27:34", "11:29:42", "11:30:32", "11:31:05", "11:31:08", "11:31:54", "11:33:57", "11:36:59", "11:37:29", "11:37:48", "11:38:34", "11:40:36", "11:41:20", "11:41:24", "11:42:30", "11:43:07", "11:44:25", "11:44:37", "11:45:46", "11:46:16", "11:47:43", "11:49:24", "11:51:38", "11:53:57", "11:57:09", "11:58:07", "12:01:12", "12:01:45", "12:01:45", "12:01:46", "12:04:00", "12:04:01", "12:11:09", "12:13:16", "12:17:28", "12:17:59", "12:19:12", "12:23:18", "12:23:55", "12:39:50", "12:41:32", "12:43:43", "12:44:52", "12:53:33", "12:56:29", "13:02:22", "13:03:07", "13:12:29", "13:13:22", "13:14:29", "13:15:21", "13:18:40", "13:22:05", "13:22:45", "13:23:24", "13:29:03", "13:29:35", "13:29:52", "13:36:47", "13:37:47", "13:40:11", "13:40:43", "13:42:11", "13:44:26", "13:46:01", "13:46:05", "13:46:45", "13:48:53", "13:48:58", "13:49:45", "13:49:45", "13:49:56", "13:55:39", "13:55:47", "13:59:40", "13:59:40", "14:01:18", "14:01:42", "14:02:36", "14:06:10", "14:07:17", "14:07:21", "14:07:21", "14:08:23", "14:08:49", "14:08:58", "14:10:27", "14:11:47", "14:13:06", "14:15:19", "14:18:51", "14:19:00", "14:19:36", "14:20:22", "14:22:13", "14:23:25", "14:23:31", "14:23:31", "14:24:54", "14:25:52", "14:26:08", "14:26:19", "14:26:56", "14:28:38", "14:30:37", "14:32:03", "14:33:27", "14:33:28", "14:33:28", "14:33:41", "14:34:03", "14:34:44", "14:34:58", "14:36:21", "14:38:28", "14:41:18", "14:41:37", "14:41:59", "14:42:37", "14:43:26", "14:43:43", "14:44:17", "14:44:21", "14:45:30", "14:45:31", "14:45:32", "14:45:32", "14:45:34", "14:45:44", "14:46:14", "14:47:51", "14:50:09", "14:50:10", "14:50:17", "14:50:21", "14:50:41", "14:54:20", "14:54:39", "14:54:54", "14:55:15", "14:55:23", "14:56:02", "14:56:24", "14:56:56", "14:57:22", "14:57:24", "14:57:52", "14:58:31", "14:58:43", "14:58:44", "14:59:17", "15:00:18", "15:00:39", "15:00:44", "15:00:53", "15:01:02", "15:01:10", "15:01:22", "15:01:27", "15:01:36", "15:01:36", "15:01:45", "15:01:54", "15:02:01", "15:02:11", "15:02:11", "15:02:19", "15:02:26", "15:02:34", "15:02:35", "15:02:45", "15:03:24", "15:03:32", "15:03:51", "15:04:47", "15:04:48", "15:05:02", "15:05:02", "15:05:36", "15:06:31", "15:06:32", "15:06:33", "15:06:34", "15:06:50", "15:07:33", "15:07:45", "15:07:47", "15:08:44", "15:09:09", "15:11:44", "15:13:35", "15:14:01", "15:14:51", "15:19:33", "15:19:48", "15:20:10", "15:20:50", "15:23:53", "15:24:03", "15:24:19", "15:24:37", "15:26:10", "15:27:18", "15:27:46", "15:27:47", "15:28:14", "15:28:42", "15:30:20", "15:31:49", "15:33:23", "15:33:44", "15:33:55", "15:34:07", "15:34:22", "15:34:42", "15:34:59", "15:35:06", "15:35:15", "15:35:23", "15:36:14", "15:38:20", "15:38:39", "15:39:43", "15:41:38", "15:42:56", "15:43:57", "15:44:16", "15:45:30", "15:45:44", "15:46:20", "15:46:38", "15:46:53", "15:48:15", "15:48:20", "15:49:06", "15:49:29", "15:49:30", "15:49:31", "15:49:32", "15:49:33", "15:49:34", "15:49:56", "15:49:56", "15:50:39", "15:52:40", "15:53:00", "15:54:01", "15:56:11", "15:56:16", "15:57:14", "15:57:29", "15:58:30", "15:58:33", "15:58:41", "15:59:17", "15:59:38", "15:59:42", "16:00:14", "16:01:49", "16:02:09", "16:02:12", "16:02:24", "16:02:57", "16:04:17", "16:04:21", "16:05:08", "16:05:46", "16:07:02", "16:07:07", "16:09:24", "16:09:54", "16:10:36", "16:11:47", "16:12:29", "16:12:50", "16:12:52", "16:13:41", "16:13:47", "16:14:18", "16:14:39", "16:14:42", "16:15:10", "16:15:31", "16:15:34", "16:15:53", "16:16:00", "16:16:57", "16:17:02", "16:17:58", "16:18:33", "16:21:09", "16:21:09", "16:23:07", "16:23:20", "16:23:42", "16:23:47", "16:23:48", "16:24:35", "16:26:49", "16:27:23", "16:27:28", "16:28:07", "16:29:30", "16:30:37", "16:31:16", "16:32:32", "16:33:56", "16:38:43", "16:41:19", "16:43:00", "16:43:57", "16:45:00", "16:45:56", "16:46:43", "16:47:35", "16:49:00", "16:49:10", "16:49:50", "16:50:34", "16:53:28", "16:54:16", "16:58:28", "16:59:50", "17:05:46", "17:08:01", "17:09:49", "17:10:58", "17:13:18", "17:16:12", "17:16:43", "17:17:41", "17:19:47", "17:21:25", "17:23:16", "17:23:18", "17:24:28", "17:28:08", "17:28:09", "17:30:05", "17:30:55", "17:31:26", "17:34:53", "17:37:36", "17:38:08", "17:39:56", "17:41:07", "17:49:11", "17:50:03", "17:52:47", "17:52:58", "17:54:36", "17:55:20", "17:57:07", "17:58:01", "18:01:22", "18:18:24", "18:21:02", "18:21:37", "18:25:59", "18:31:54", "18:31:55", "18:33:53", "18:35:20", "18:35:21", "18:47:14", "19:15:57", "19:26:03", "19:37:03", "19:56:39", "20:09:54" };


        private static string[] s_times2 = new string[] { "08:46:02", "09:03:51", "09:06:05", "09:08:38", "09:09:10", "09:10:58", "09:13:17", "09:13:45", "09:17:55", "09:19:05", "09:20:20", "09:21:34", "09:22:28", "09:22:29", "09:22:46", "09:23:25", "09:23:33", "09:24:10", "09:24:12", "09:24:21", "09:25:03", "09:25:50", "09:25:59", "09:26:57", "09:27:21", "09:27:58", "09:27:59", "09:28:04", "09:28:26", "09:28:46", "09:29:17", "09:30:43", "09:31:54", "09:32:58", "09:33:34", "09:33:34", "09:33:35", "09:34:20", "09:34:41", "09:34:42", "09:35:52", "09:37:05", "09:41:39", "09:41:55", "09:44:29", "09:45:21", "09:49:41", "09:52:29", "09:53:05", "09:56:57", "09:58:50", "09:59:17", "10:05:51", "10:07:18", "10:07:19", "10:09:39", "10:10:55", "10:12:14", "10:12:46", "10:14:00", "10:19:48", "10:21:30", "10:21:31", "10:21:32", "10:21:33", "10:22:26", "10:26:37", "10:27:07", "10:27:52", "10:29:19", "10:31:05", "10:32:40", "10:33:11", "10:33:12", "10:33:12", "10:33:52", "10:33:53", "10:33:53", "10:33:53", "10:33:53", "10:33:53", "10:33:53", "10:34:37", "10:34:38", "10:34:38", "10:34:38", "10:34:38", "10:34:38", "10:34:38", "10:34:39", "10:35:17", "10:35:17", "10:35:17", "10:35:17", "10:35:18", "10:35:18", "10:35:18", "10:35:18", "10:35:18", "10:35:18", "10:35:19", "10:35:19", "10:35:29", "10:36:08", "10:36:09", "10:36:09", "10:36:09", "10:36:59", "10:37:00", "10:37:00", "10:37:44", "10:37:46", "10:38:12", "10:38:12", "10:40:39", "10:42:17", "10:43:43", "10:44:13", "10:44:30", "10:46:35", "10:47:27", "10:48:37", "10:48:43", "10:56:14", "10:57:33", "10:58:17", "10:58:18", "10:58:31", "10:59:06", "10:59:53", "11:01:34", "11:06:20", "11:07:06", "11:08:30", "11:08:54", "11:09:55", "11:10:28", "11:11:18", "11:11:19", "11:12:03", "11:12:27", "11:14:12", "11:14:59", "11:16:09", "11:16:55", "11:18:54", "11:22:46", "11:30:18", "11:30:37", "11:35:16", "11:35:44", "11:38:22", "12:01:45", "12:01:46", "12:01:46", "12:06:13", "12:08:48", "12:11:09", "12:13:16", "12:26:36", "12:26:37", "12:26:37", "12:26:38", "12:26:38", "12:26:38", "12:26:39", "12:26:39", "12:27:33", "12:37:41", "12:39:02", "12:43:43", "12:49:17", "12:55:02", "13:02:05", "13:05:44", "13:07:26", "13:08:43", "13:08:43", "13:08:43", "13:08:43", "13:08:43", "13:11:08", "13:24:17", "13:31:44", "13:36:25", "13:41:12", "13:42:53", "13:45:49", "13:49:45", "13:52:12", "13:52:40", "13:55:19", "13:56:57", "13:59:40", "13:59:40", "14:06:06", "14:08:54", "14:11:22", "14:12:08", "14:13:06", "14:13:57", "14:15:19", "14:18:26", "14:20:22", "14:22:46", "14:24:27", "14:29:45", "14:31:59", "14:32:21", "14:33:27", "14:33:28", "14:33:28", "14:35:20", "14:35:58", "14:38:27", "14:39:10", "14:42:09", "14:43:20", "14:43:33", "14:44:17", "14:45:30", "14:45:31", "14:45:32", "14:45:33", "14:45:34", "14:46:16", "14:47:59", "14:50:09", "14:50:10", "14:50:48", "14:52:46", "14:54:33", "14:56:53", "14:57:08", "14:57:52", "14:58:43", "14:58:58", "15:00:39", "15:02:18", "15:02:18", "15:03:55", "15:05:49", "15:06:02", "15:06:31", "15:06:32", "15:06:32", "15:06:33", "15:06:34", "15:06:55", "15:07:47", "15:10:32", "15:11:09", "15:11:44", "15:12:14", "15:12:52", "15:19:21", "15:19:48", "15:20:07", "15:21:02", "15:21:07", "15:21:38", "15:22:43", "15:23:23", "15:23:32", "15:24:20", "15:24:25", "15:25:07", "15:25:43", "15:26:06", "15:26:30", "15:26:37", "15:27:46", "15:28:07", "15:28:40", "15:29:19", "15:29:29", "15:29:45", "15:29:59", "15:30:49", "15:31:03", "15:32:27", "15:33:43", "15:36:34", "15:36:57", "15:39:04", "15:39:18", "15:39:55", "15:40:53", "15:43:57", "15:48:28", "15:49:29", "15:49:30", "15:49:31", "15:49:32", "15:49:33", "15:49:34", "15:51:19", "15:52:46", "15:53:00", "15:53:43", "15:54:10", "15:54:44", "15:55:06", "15:55:12", "15:56:45", "15:56:51", "15:58:20", "16:01:16", "16:01:54", "16:02:12", "16:03:57", "16:04:34", "16:05:10", "16:08:10", "16:08:15", "16:08:40", "16:08:41", "16:09:13", "16:09:47", "16:09:58", "16:10:16", "16:10:31", "16:10:57", "16:11:26", "16:11:59", "16:12:02", "16:12:23", "16:13:20", "16:15:07", "16:16:24", "16:16:45", "16:17:18", "16:17:21", "16:17:35", "16:18:27", "16:18:33", "16:19:14", "16:19:16", "16:19:31", "16:19:58", "16:20:43", "16:21:13", "16:21:18", "16:23:13", "16:23:44", "16:26:07", "16:26:38", "16:26:42", "16:27:07", "16:27:37", "16:27:48", "16:28:18", "16:28:36", "16:28:44", "16:29:01", "16:29:32", "16:31:42", "16:33:24", "16:34:09", "16:35:10", "16:35:33", "16:35:38", "16:36:12", "16:36:48", "16:37:17", "16:37:40", "16:37:59", "16:38:27", "16:38:48", "16:39:12", "16:44:22", "16:44:53", "16:45:03", "16:45:26", "16:45:51", "16:46:25", "16:47:18", "16:48:19", "16:51:30", "16:51:45", "16:51:56", "16:52:50", "16:55:13", "16:55:33", "16:55:51", "16:58:58", "17:01:14", "17:01:44", "17:02:09", "17:02:36", "17:03:01", "17:03:25", "17:03:47", "17:03:48", "17:03:54", "17:04:11", "17:04:34", "17:06:00", "17:06:29", "17:10:19", "17:10:28", "17:11:33", "17:12:29", "17:13:07", "17:13:20", "17:13:37", "17:14:37", "17:15:04", "17:15:24", "17:15:45", "17:15:46", "17:16:08", "17:20:23", "17:22:41", "17:23:53", "17:25:06", "17:28:42", "17:29:45", "17:31:37", "17:31:58", "17:35:26", "17:35:51", "17:38:16", "17:38:40", "17:39:11", "17:41:35", "17:47:16", "17:50:19", "17:50:40", "17:51:02", "17:53:31", "17:54:04", "17:54:22", "17:55:53", "17:56:04", "17:58:10", "17:58:32", "18:02:08", "18:03:56", "18:18:55", "18:21:35", "18:26:29", "18:32:27", "18:35:54" };
        public static string ConnectionString;

        static KongyunController()
        {
        }


        [HttpGet]
        public SingleResult<long> Total(string name)
        {
            if (string.Equals(name, "jswtds", StringComparison.CurrentCultureIgnoreCase))
            {
                return JSWTDS();
            }
            else if (string.Equals(name, "dcjy", StringComparison.CurrentCultureIgnoreCase))
            {
                return DCJY();
            }
            else if (string.Equals(name, "cg", StringComparison.CurrentCultureIgnoreCase))
            {
                return CG();
            }
            else if (string.Equals(name, "dd", StringComparison.CurrentCultureIgnoreCase))
            {
                return DD();
            }
            return new SingleResult<long>(0);
        }

        private static DateTime[] s_datetime1 = null;
        private static DateTime[] s_datetime2 = null;

        public static int[] s_baseValueArr = new int[]{
            8,2,5,6,
            10,4,8,9,
            5,4,6,7,
            12,9,12,13,
            7,6,8,10,
            1,2,2,3,
            2,1,1,2
        };
        //星期	接受委托	订舱交运	出港	到达
        //一	8	2	5	6
        //二	10	4	8	9
        //三	5	4	6	7
        //四	12	9	12	13
        //五	7	6	8	10
        //六	1	2	2	3
        //日	2	1	1	2

        private int GetWeekInt(DateTime now)
        {
            if (now.DayOfWeek == DayOfWeek.Monday)
            {
                return 0;
            }
            else if (now.DayOfWeek == DayOfWeek.Tuesday)
            {
                return 1;
            }
            else if (now.DayOfWeek == DayOfWeek.Wednesday)
            {
                return 2;
            }
            else if (now.DayOfWeek == DayOfWeek.Thursday)
            {
                return 3;
            }
            else if (now.DayOfWeek == DayOfWeek.Friday)
            {
                return 4;
            }
            else if (now.DayOfWeek == DayOfWeek.Saturday)
            {
                return 5;
            }
            else if (now.DayOfWeek == DayOfWeek.Sunday)
            {
                return 6;
            }
            return 0;
        }

        public int GetBaseValue(int type, int week)
        {
            return s_baseValueArr[week * 4 + type];
        }

        public SingleResult<long> JSWTDS()
        {
            DateTime now = DateTime.Now;

            if (s_datetime1 == null || s_datetime1[0].Date != now.Date)
            {
                s_datetime1 = new DateTime[s_times1.Length];
                for (int index = 0; index < s_times1.Length; index++)
                {
                    s_datetime1[index] = Convert.ToDateTime(string.Format("{0} {1}", now.ToString("yyyy-MM-dd"), s_times1[index]));
                }
            }
            if (now > s_datetime1.Last())
            {
                return new SingleResult<long>(GetBaseValue(0, GetWeekInt(now)) + s_datetime1.Length);
            }
            else if (now < s_datetime1[0])
            {
                return new SingleResult<long>(GetBaseValue(0, GetWeekInt(now)) + 0);
            }
            for (int index = 0; index < s_datetime1.Length; index++)
            {
                if (s_datetime1[index] > now)
                {
                    return new SingleResult<long>(GetBaseValue(0, GetWeekInt(now)) + (long)index);
                }
            }
            return new SingleResult<long>(GetBaseValue(0, GetWeekInt(now)) + 0);
        }

        public SingleResult<long> DCJY()
        {
            DateTime now = DateTime.Now;
            if (s_datetime2 == null || s_datetime2[0].Date != now.Date)
            {
                s_datetime2 = new DateTime[s_times2.Length];
                for (int index = 0; index < s_times2.Length; index++)
                {
                    s_datetime2[index] = Convert.ToDateTime(string.Format("{0} {1}", now.ToString("yyyy-MM-dd"), s_times2[index]));
                }
            }

            if (now > s_datetime2.Last())
            {
                return new SingleResult<long>(GetBaseValue(1, GetWeekInt(now)) + s_datetime2.Length);
            }
            else if (now < s_datetime1[0])
            {
                return new SingleResult<long>(GetBaseValue(1, GetWeekInt(now)) + 0);
            }

            for (int index = 0; index < s_datetime2.Length; index++)
            {
                if (s_datetime2[index] > now)
                {
                    return new SingleResult<long>(GetBaseValue(1, GetWeekInt(now)) + (long)index);
                }
            }
            return new SingleResult<long>(GetBaseValue(1, GetWeekInt(now)) + 0);
        }
        /// <summary>
        /// 出港
        /// </summary>
        /// <returns></returns>
        public SingleResult<long> CG()
        {
            DateTime now = DateTime.Now;
            if (s_datetime2 == null || s_datetime2[0].Date != now.Date)
            {
                s_datetime2 = new DateTime[s_times2.Length];
                for (int index = 0; index < s_times2.Length; index++)
                {
                    s_datetime2[index] = Convert.ToDateTime(string.Format("{0} {1}", now.ToString("yyyy-MM-dd"), s_times2[index]));
                }
            }


            if (now > s_datetime2.Last())
            {
                if (s_datetime2.Length * 0.3 > 1)
                {
                    return new SingleResult<long>(GetBaseValue(2, GetWeekInt(now)) + (long)(s_datetime2.Length * 0.3));
                }
                else
                {
                    return new SingleResult<long>(GetBaseValue(2, GetWeekInt(now)) + 0);
                }
            }
            else if (now < s_datetime1[0])
            {
                return new SingleResult<long>(GetBaseValue(2, GetWeekInt(now)) + 0);
            }

            for (int index = 0; index < s_datetime2.Length; index++)
            {
                if (s_datetime2[index] > now)
                {
                    if (index * 0.3 > 1)
                    {
                        return new SingleResult<long>(GetBaseValue(2, GetWeekInt(now)) + (long)(index * 0.3));
                    }
                    else
                    {
                        return new SingleResult<long>(GetBaseValue(2, GetWeekInt(now)) + 0);
                    }
                }
            }
            return new SingleResult<long>(GetBaseValue(2, GetWeekInt(now)) + 0);
        }

        /// <summary>
        /// 到达 
        /// </summary>
        /// <returns></returns>
        public SingleResult<long> DD()
        {
            DateTime now = DateTime.Now;
            if (s_datetime2 == null || s_datetime2[0].Date != now.Date)
            {
                s_datetime2 = new DateTime[s_times2.Length];
                for (int index = 0; index < s_times2.Length; index++)
                {
                    s_datetime2[index] = Convert.ToDateTime(string.Format("{0} {1}", now.ToString("yyyy-MM-dd"), s_times2[index]));
                }
            }

            if (now > s_datetime2.Last())
            {
                if (s_datetime2.Length * 0.3 * 0.8 > 1)
                {
                    return new SingleResult<long>(GetBaseValue(3, GetWeekInt(now)) + (long)(s_datetime2.Length * 0.3 * 0.8));
                }
                else
                {
                    return new SingleResult<long>(GetBaseValue(3, GetWeekInt(now)) + 0);
                }
            }
            else if (now < s_datetime1[0])
            {
                return new SingleResult<long>(GetBaseValue(3, GetWeekInt(now)) + 0);
            }
            for (int index = 0; index < s_datetime2.Length; index++)
            {
                if (s_datetime2[index] > now)
                {
                    if (index * 0.3 * 0.8 > 10)
                    {
                        return new SingleResult<long>(GetBaseValue(3, GetWeekInt(now)) + (long)(index * 0.3 * 0.8));
                    }
                    else
                    {
                        return new SingleResult<long>(GetBaseValue(3, GetWeekInt(now)) + 0);
                    }
                }
            }
            return new SingleResult<long>(GetBaseValue(3, GetWeekInt(now)) + 0);
        }
    }
}
